<!doctype html>
<html lang="cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>编辑资料</title>
    <link rel="stylesheet" href="/static/app/lib/iconfont/iconfont.css">
    <link rel="stylesheet" href="/static/app/css/style.css">
    <script src="/static/app/lib/zy.rem.js"></script>
    <script src="/static/app/lib/jquery1.12.3.min.js"></script>
    <script src="/static/app/js/base.js"></script>
    <link rel="stylesheet" href="/static/app/css/core.css">
    <script src="/static/layer/layer.min.js"></script>

    <style>
        .add{
            width: 64%;
            height: 0.4rem;
            margin-left: 0.6rem;
            background:transparent;
            border:none;
            outline:medium;
        }
        .lad{
            margin-left: 0.6rem;
            color: #000;
            font-size: 0.25rem;
        }
        .info-links{
            margin-top: 0.5rem;
        }
        .button_lar{
            width: 90%;
            height: 0.7rem;
            margin-left: 5%;
            margin-top: 0.5rem;
            margin-bottom: 0.5rem;
            color: #fff;
            font-size: 0.3rem;
            border: 0;
            border-radius:0.1rem;
            background-color: #0b76ac;
            outline:none;
        }
    </style>
</head>
<body>
<div class="header">
    <div><a href="javascript:history.back(-1)"><img src="/static/app/img/fanh.png"></a></div>
    <div>绑定新设备</div>
    <div></div>
    <!--<div><a href="javascript:;" class="head-btn iconfont">&#xe765;</a></div>-->
</div>
<div class="center">
    <div class="info">
        <div class="info-tou"><img src="/static/app/img/toux.png" /></div>
        <h3>{$Think.session.appuser.nickname}</h3>
    </div>
    <div class="info-links">

        <form method="post" id="form">
            <a href="javascript:;">IMEI
                <input type="text" class="add" name="imei"  required="ture" placeholder="请输入未绑定设备号">
            </a>
            <button type="button" class="button_lar" onclick="roleSubmit()">保存</button>
        </form>
    </div>

</div>
</body>
{include file='public:bottom'}
<script>
    //提交
    function roleSubmit(){
        if($('[name="imei"]').val() == '' ){
            layer.alert('请输入IMEI(设备号)', {icon: 2});
            return false;
        }
        var form=document.getElementById("form");
        var formData=new FormData(form);

        $.ajax({
            url:"{:Url('addData')}",
            type:'POST',
            data:formData,
            async: false,
            cache: false,
            contentType: false, //不设置内容类型
            processData: false, //不处理数据
            success:function(res){
                if (res.code != 200) {
                    layer.msg(res.msg, {shade: 0.5, time: 1000,icon: 2});
                    return false;
                }
                layer.msg(res.msg, {shade: 0.5, time: 800, icon: 1}, function(){
                    // window.location.href="{:url('index')}";
                    window.location.reload();
                });
            }
        });
    }


</script>
</html>